#include //include the library #define I2C_SLAVE_ADDRESS 0x6//define the address for the slave int LED = 7; void setup() { TinyWireS.begin(I2C_SLAVE_ADDRESS); //setup initialization, join as slave pinMode(LED, OUTPUT); } void loop() { byte byteRcvd =0; volatile byte msg =0;//treat as variable if(TinyWireS.available()){ //if input and slave available byteRcvd = TinyWireS.receive(); //receive from master if (byteRcvd == 0x01){ //if bytes received digitalWrite (LED, HIGH); //turn off LED TinyWireS.send(4);//send message } else { digitalWrite (LED, LOW);//turn on LED TinyWireS.send(5); //send message } } }